 /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ivana
 */
@Entity
@Table(name = "recepcion")
@NamedQueries({
    @NamedQuery(name = "Recepcion.findAll", query = "SELECT r FROM Recepcion r"),
    @NamedQuery(name = "Recepcion.findByNumeroRecepcion", query = "SELECT r FROM Recepcion r WHERE r.numeroRecepcion = :numeroRecepcion"),
    @NamedQuery(name = "Recepcion.findByContrato", query = "SELECT r FROM Recepcion r WHERE r.contrato = :contrato"),
    @NamedQuery(name = "Recepcion.findByFechaHoraRecepcion", query = "SELECT r FROM Recepcion r WHERE r.fechaHoraRecepcion = :fechaHoraRecepcion")})
public class Recepcion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "numeroRecepcion")
    private Integer numeroRecepcion;
    @Basic(optional = false)
    @Column(name = "fechaHoraRecepcion")
    private String fechaHoraRecepcion;
    @JoinColumn(name = "idCargaEmpaque", referencedColumnName = "idCargaEmpaque")
    @ManyToOne(optional = false)
    private Cargaempaque cargaempaque;
    @JoinColumn(name = "idTransportista", referencedColumnName = "idTransportista")
    @ManyToOne(optional = false)
    private Transportista transportista;
    @JoinColumn(name = "idRemito", referencedColumnName = "idRemito")
    @ManyToOne(optional = false)
    private Remito remito;
    @JoinColumn(name = "idTransporte", referencedColumnName = "idTransporte")
    @ManyToOne(optional = false)
    private Transporte transporte;
    @JoinColumn(name = "numeroContrato", referencedColumnName = "numeroContrato")
    @ManyToOne(optional = false)
    private Contrato contrato;
    @JoinColumn(name = "idOperario", referencedColumnName = "idoperario")
    @ManyToOne
    private Operario operario;
    @OneToMany(mappedBy = "recepcion")
    private Collection<Detallerecepcion> detallerecepcionCollection;

    public Recepcion() {
    }

    public Recepcion(Integer numeroRecepcion) {
        this.numeroRecepcion = numeroRecepcion;
    }

    public Recepcion(Integer numeroRecepcion, String fechaHoraRecepcion) {
        this.numeroRecepcion = numeroRecepcion;
        this.fechaHoraRecepcion = fechaHoraRecepcion;
    }

    public Integer getNumeroRecepcion() {
        return numeroRecepcion;
    }

    public void setNumeroRecepcion(Integer numeroRecepcion) {
        this.numeroRecepcion = numeroRecepcion;
    }

    public String getFechaHoraRecepcion() {
        return fechaHoraRecepcion;
    }

    public void setFechaHoraRecepcion(String fechaHoraRecepcion) {
        this.fechaHoraRecepcion = fechaHoraRecepcion;
    }

    public Cargaempaque getCargaempaque() {
        return cargaempaque;
    }

    public void setCargaempaque(Cargaempaque cargaempaque) {
        this.cargaempaque = cargaempaque;
    }

    public Transportista getTransportista() {
        return transportista;
    }

    public void setTransportista(Transportista transportista) {
        this.transportista = transportista;
    }

    public Remito getRemito() {
        return remito;
    }

    public void setRemito(Remito remito) {
        this.remito = remito;
    }

    public Transporte getTransporte() {
        return transporte;
    }

    public void setTransporte(Transporte transporte) {
        this.transporte = transporte;
    }

    public Contrato getContrato() {
        return contrato;
    }

    public void setContrato(Contrato contrato) {
        this.contrato = contrato;
    }

    public Operario getOperario() {
        return operario;
    }

    public void setOperario(Operario operario) {
        this.operario = operario;
    }

    public Collection<Detallerecepcion> getDetallerecepcionCollection() {
        return detallerecepcionCollection;
    }

    public void setDetallerecepcionCollection(Collection<Detallerecepcion> detallerecepcionCollection) {
        this.detallerecepcionCollection = detallerecepcionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numeroRecepcion != null ? numeroRecepcion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Recepcion)) {
            return false;
        }
        Recepcion other = (Recepcion) object;
        if ((this.numeroRecepcion == null && other.numeroRecepcion != null) || (this.numeroRecepcion != null && !this.numeroRecepcion.equals(other.numeroRecepcion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Recepcion[numeroRecepcion=" + numeroRecepcion + "]";
    }

}
